//
//  NoticeController.swift
//  Order
//
//  Created by Lazyloading on 2020/7/22.
//  Copyright © 2020 lazyloading. All rights reserved.
//

import UIKit
import QMUIKit

class NoticeController: UIViewController {

    lazy var noticeLabel: QMUITextView = {
        let label = QMUITextView.init();
        label.font = UIFont.init(fontType: .regular, fontSize: 15);
        label.textColor = ZMColor.Black.black1;
        label.isEditable = false;
        label.backgroundColor  = ZMColor.Gray.gray1;
        return label;
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.loadDefaultSetting();
        self.initSubViews();
        self.noticeRequest();
        
    }
    
    // MARK: 👉🏻 🐷Life cycle🐷
    // MARK: 👉🏻 🐷System Delegate🐷
    // MARK: 👉🏻 🐷Custom Delegate🐷
    // MARK: 👉🏻 🐷Event  Response🐷
    // MARK: 👉🏻 🐷Private Methods🐷
    //公告请求
    func noticeRequest()  {
        weak var weakSelf = self;
        MoyaRequest(.notice, success: { (response : BaseResponse<NoticeModel>) in
            if response.respCode == 200{
                weakSelf!.noticeLabel.text = response.data?.content;
            }
        }) { (error) in
            
        }
    }
    // MARK: 👉🏻 🐷Lazy loading🐷
    // MARK: 👉🏻 🐷Init SubViews🐷
    func loadDefaultSetting()  {
        self.navigationItem.title = "公告";
        self.view.backgroundColor = ZMColor.Gray.gray1;
    }
    
    func initSubViews()  {
        self.view.addSubview(self.noticeLabel);
        
        
        self.noticeLabel.snp.makeConstraints { (make) in
            
            make.leading.top.equalToSuperview().offset(15);
            make.trailing.equalToSuperview().offset(-15);
            make.bottom.equalToSuperview().offset(-(SafeBottom_H+15));
            
        };
        
    }

}
